package cn.yy.cloudpay.util;

/**
 * Created by Administrator on 2018/1/18.
 */

public class SerialUtils {
    //地址:401~416
    public static String readAddr(int num){
        byte[] address = new byte[2];
        address[0] = (byte)((num >> 8) & 0x000000FF);
        address[1] = (byte)(num & 0x000000FF);
        String hexAds = StringUtil.byte2HexStr(address);
        return hexAds;
    }

    //数据:1
    public static String readData(int num){
        byte[] data = new byte[2];
        data[0] = (byte)((num >> 8) & 0x000000FF);
        data[1] = (byte)(num & 0x000000FF);
        String hex = StringUtil.byte2HexStr(data);
        return hex;
    }
}
